import axios from './api' // 倒入 api
import config from './config.js' // 倒入默认配置
export const BASEURL = config.baseURL

/* 将所有接口统一起来便于维护
 * 如果项目很大可以将 url 独立成文件，接口分成不同的模块
 */

export const IMAGEPATH = BASEURL + 'appserver'

// 客户-客户列表
export const GETCUSTOMERSEARCH = (params) => {
  return axios({
    url: 'customer/search',
    method: 'GET',
    params,
  })
}

// 客户-客户列表-新增客户
export const ADDCUSTOMERINFO = (params) => {
  return axios({
    url: 'customer/add',
    method: 'POST',
    data: params,
  })
}

// 客户-客户列表-编辑客户
export const EDITCUSTOMERINFO = (params) => {
  return axios({
    url: 'customer/edit',
    method: 'POST',
    data: params,
  })
}

// 客户-客户列表-获取用户详情
export const GETCUSTOMERINFO = (params) => {
  return axios({
    url: 'customer/info',
    method: 'GET',
    params,
  })
}

// 客户-客户列表-客户详情-代办设置
export const ADDTODOINFO = (params) => {
  return axios({
    url: 'todo/add',
    method: 'POST',
    data: params,
  })
}

// 客户-客户列表-客户详情-跟进信息列表
export const GETCUSTOMERFOLLOWUPS = (params) => {
  return axios({
    url: 'customer/getFollowups',
    method: 'GET',
    params,
  })
}

// 客户-客户列表-客户详情-发布跟进信息
export const ADDFOLLOWUPINFO = (params) => {
  return axios({
    url: 'customer/followup',
    method: 'POST',
    data: params,
  })
}

// 客户-客户列表-批量修改客户
export const BATCHMODIFYCUSTOMER = (params) => {
  return axios({
    url: 'customer/batchModify',
    method: 'POST',
    data: params,
  })
}

// 客户-客户列表-批量导出客户
export const BATCHCUSTOMEREXPORT = BASEURL + 'customer/batchExport'

// 客户-客户列表-批量删除客户
export const BATCHDELETECUSTOMER = (params) => {
  return axios({
    url: 'customer/batchDelete',
    method: 'GET',
    params,
  })
}


// 客户-客户列表-获取客户列表（不分页）
export const GETCUSTOMEROPTIONS = (params) => {
  return axios({
    url: 'customer/options',
    method: 'GET',
    params,
  })
}

// 客户-客户列表-全局获取客户列表（不分页）
export const GETCUSTOMERGLOBALOPTIONS = (params) => {
  return axios({
    url: 'customer/globalOptions',
    method: 'GET',
    params,
  })
}

// 客户管理-批量导入客户
export const IMPORTCUSTOMERINFO = BASEURL + 'customer/import'
// export const IMPORTCUSTOMERINFO = (params) => {
//   return axios({
//     url: 'customer/import',
//     method: 'POST',
//     data:params,
//   })
// }

// 客户-客户列表-加入公海、标星、取消标星
export const BATCHMARKCUSTOMERINFO = (params) => {
  return axios({
    url: 'customer/batchMark',
    method: 'POST',
    data:params,
  })
}

// 客户-客户列表-客户详情-获取回访记录
export const GETRETURNVISITRECORDS = (params) => {
  return axios({
    url: 'returnvisit/records',
    method: 'GET',
    params,
  })
}

// 客户-客户详情-客户打标签
export const SAVE_CUSTOMER_TAG = (params) => {
  return axios({
    url: 'customer/tag',
    method: 'POST',
    data:params,
  })
}